package org.csu.spring.demo.ioc.test;

import org.csu.spring.demo.ioc.service.AccountService;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.test.context.ContextConfiguration;
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;

@RunWith(SpringJUnit4ClassRunner.class)
@ContextConfiguration("classpath:applicationContext.xml")
public class demo {
    @Autowired
    private AccountService service;
    @Test
    public void test(){
        //AccountDao accountDao=new AccountDaoImpl();

 //       ApplicationContext context =new ClassPathXmlApplicationContext("applicationContext.xml");
//        AccountService service=(AccountService) context.getBean("accountService");
//        service.login();
        //        AccountDao accountDao=(AccountDao)context.getBean("accountDAO");
//                Account temp=(Account) context.getBean("account");
//
      //  AccountService service=(AccountService) context.getBean("accountService");
     //   System.out.println(temp.getUsername()+","+temp.getPassword()+","+temp.getAge());
        service.login();
        service.did();
        }
    }
